package com.ljsw.server;

import android.util.Log;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.ljsw.application.App;
import com.ljsw.entity.OperateLog;
import com.ljsw.entity.User;
import com.ljsw.entity.pkentity.Reconcil.Page;
import com.ljsw.url.ServerUrl;

import org.ksoap2.serialization.SoapObject;

/**
 * @author 郑鸿博
 * @version V1.0
 * @Package com.ljsw.server
 * @Description: TODO(上门服务接口管理类)
 * @date 2015-11-24 上午9:46:26
 */
public class UpServer {
    private static final String TAG = "UpServer";

    /**
     * 用户登录接口
     *
     * @param userId
     * @param pwd
     * @return
     * @throws Exception
     */
    public static User login(String userId, String pwd) throws Exception {
        String mothedName = "login";//在服务端掉用的方法
        @SuppressWarnings("rawtypes")
        WebParameter[] param = {new WebParameter<String>("arg0", userId),
                new WebParameter<String>("arg1", pwd)};
        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL);
        Log.e("upservice", soap + "========soap");
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("用户：" + params);
        String msg = soap.getProperty("msg").toString();
        App.getApp().fanhuiMsg = msg;
        User user = null;
        if (code.equals("00")) {
            user = new User();
            String[] array = params.split(";");//截取字符有： 返回 一个数组
            System.out.println(params);
            user.setName(array[0]);
            user.setOrganizationName(array[1]);
            user.setUserId(array[2]);
            user.setOrganizationId(array[3]);
            return user;
        }
        return null;
    }

    /**
     * 根据车牌号查询任务
     *
     * @param carId ,userId 用户账号
     * @return
     * @throws Exception
     */
    public static String getRenwuList(String carId, String state, String userId) throws Exception {
        String mothedName = "getRenwuList";
        @SuppressWarnings("rawtypes")
        WebParameter[] param = {new WebParameter<String>("arg0", carId),
                new WebParameter<String>("arg1", state), new WebParameter<String>("arg2", userId)};

        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        System.out.println("----------getRenwuList:" + soap);
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("车牌号：" + carId + "state:=" + state);
        System.out.println("params:=" + params + "code:=" + code);
        if (code.equals("00")) {
            System.out.println(params);
            return params;
        } else if (code.equals("11")) {
            return params;
        }
        return null;
    }

    /**
     * 根据派工单和服务模式 ---- 获取任务明细
     *
     * @param paigongdan
     * @param fuwumoshi
     * @return
     * @throws Exception
     */
    public static String getRenwuListMingXi(String paigongdan, String fuwumoshi) throws Exception {
        String mothedName = "getRenwuListMingXi";
        @SuppressWarnings("rawtypes")
        WebParameter[] param = {new WebParameter<String>("arg0", paigongdan),
                new WebParameter<String>("arg1", fuwumoshi)};
        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        System.out.println("----------getRenwuListMingXi:" + soap);
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();
        if (code.equals("00")) {
            return params;
        }
        return null;
    }

    /**
     * 根据所有派工单和押运员ID
     *
     * @param paigongdan
     * @param fuwumoshi
     * @param card
     * @return
     * @throws Exception
     */
    public static String setRenwuLingqu(String paigongdan, String yayunId, String carId) throws Exception {
        String mothedName = "setRenwuLingqu";
        @SuppressWarnings("rawtypes")
        WebParameter[] param = {new WebParameter<String>("arg0", paigongdan),
                new WebParameter<String>("arg1", yayunId), new WebParameter<String>("arg2", carId)};
        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        System.out.println("----------参数:" + paigongdan + "==" + yayunId + "==" + carId);
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("params:" + params);
        if (code.equals("00")) {
            return params;
        } else if (code.equals("11")) {
            return params;
        }
        return null;
    }

    /**
     * 提交接口
     *
     * @param userid          （用户id） 全封包：押运员（1） 半封包：上门人员 （2）
     * @param fengbaostate    封包状态
     * @param qiyeyuan        企业人员：按指纹获得（2）
     * @param paigongdan      派工单
     * @param zhouzhuangxiang 周转箱 扫描获得
     * @param fileName        取值资源文件名称(例如xx.jpg)
     */
    public static String setRenwuLingqus(int fengbaostate, String userid, String qiyeyuan, String paigongdan,
                                         String zhouzhuangxiang, String fileName, String qianmingName) throws Exception {
        String mothedName = "setRenwuLingqus";
        @SuppressWarnings("rawtypes")
        WebParameter[] param = {new WebParameter<Integer>("arg0", fengbaostate),
                new WebParameter<String>("arg1", userid), new WebParameter<String>("arg2", qiyeyuan),
                new WebParameter<String>("arg3", paigongdan),
                new WebParameter<String>("arg4", zhouzhuangxiang),
                new WebParameter<String>("arg5", fileName), new WebParameter<String>("arg6", qianmingName)};
        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        System.out.println("----------setRenwuLingqus:" + soap);
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();
        if (code.equals("00")) {
            return params;
        }
        return null;
    }

    /**
     * 上传图片
     *
     * @param fileString
     * @param imageName
     * @param str
     * @return
     * @throws Exception
     */
    public static String uploadImg(byte[] fileString, String imageName,
                                   String length, String txtContext) throws Exception {
        /*
         * modify by wangmeng 2017-12-12
		 * 添加签名信息txtContext参数
		 */
        String mothedName = "uploadImg";
        WebParameter[] param = {new WebParameter<byte[]>("arg0", fileString),
                new WebParameter<String>("arg1", imageName),
                new WebParameter<String>("arg2", length),
                new WebParameter<String>("arg3", txtContext)};
        System.out.println("数组长度：" + fileString.length);
        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();
        if (code.equals("00")) {
            return params;
        }

        return null;
    }

    /**
     * 回库交接接口
     *
     * @param paigongdan
     * @param yayunId
     * @param kuguanyuan
     * @return
     * @throws Exception
     */
    public static String setHuiKu(String paigongdan, String yayunId, String kuguanyuan) throws Exception {
        String mothedName = "setHuiKu";
        WebParameter[] param = {new WebParameter<String>("arg0", paigongdan),
                new WebParameter<String>("arg1", yayunId), new WebParameter<String>("arg2", kuguanyuan)};
        SoapObject soap = null;
        soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String params = soap.getProperty("params").toString();

        Log.e("upservice", soap.toString());
        if (code.equals("00")) {
            return params;
        }
        return null;
    }

    /**
     * @param corpId 机构ID
     * @param roleId 角色Id
     * @param cValue 指纹字节数组
     * @return
     * @throws Exception
     */
    public static User yanzhengfinger(String corpId, String roleId, byte[] cValue) throws Exception {
        User user = null;
        String mothedName = "checkFingerprint";
        WebParameter[] param = {new WebParameter<String>("arg0", corpId),
                new WebParameter<String>("arg1", roleId), new WebParameter<byte[]>("arg2", cValue)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL);
        System.out.println("YanZhengZhiWen-------------传参：" + corpId + "===" + roleId);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        Log.e("upserver", "soap:=" + soap);
        if ("00".equals(code)) {
            String[] split = params.split(";");
            user = new User();
            user.setAccount(split[0]);
            user.setName(split[1]);
        } else {
            return null;
        }
        return user;
    }

    /**
     * 根据车牌号返回周转箱
     *
     * @param cardId
     * @return
     * @throws Exception
     */
    public static String getReturnZhouZhuanXiang(String cardId) throws Exception {
        String mothedName = "getReturnZhouZhuanXiang";
        WebParameter[] param = {new WebParameter<String>("arg0", cardId)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        System.out.println("YanZhengZhiWen-------------传参：" + cardId);
        System.out.println("soap:=" + soap);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /**
     * 返回车牌号信息
     *
     * @param cardId
     * @return
     * @throws Exception
     */

    public static String getReturnChePaiHao(String zhanghao) throws Exception {
        System.out.println("YanZhengZhiWen-------------传参：" + zhanghao);

        String mothedName = "getCarList";//服务端请求的方法
        SoapObject soap = WebService.getSoapObject(mothedName, null, ServerUrl.NAMESPACE, ServerUrl.URL1);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：" + zhanghao);

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /**
     * 根据用户的账号 返回车牌号
     *
     * @param cardId
     * @return
     * @throws Exception
     */
    public static String upImgShow(String path) throws Exception {
        String mothedName = "upImgShow";
        WebParameter[] param = {new WebParameter<String>("arg0", path)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("params:=" + params);
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /**
     * @throws
     * @author 名字
     * @Description: 扫描周转箱确认 (箱子ID_箱子ID)
     */
    public static String upCkZhouZhuanXiangZhanYong(String zzxBox) throws Exception {
        String mothedName = "upCkZhouZhuanXiangZhanYong";
        WebParameter[] param = {new WebParameter<String>("arg0", zzxBox)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
//		System.out.println("params:=" + params+code);
        Log.e("upserver", "params:=" + params + code);
        if ("00".equals(code)) {
            return params;
        } else if ("11".equals(code)) {
//			System.out.println("params:=" + params);
            Log.e("upserver", "params:=" + params);
            return params;
        } else if ("".equals(code)) {
//			System.out.println("null======" + params);
            Log.e("upserver", "null======" + params);
            return null;
        } else {
            return null;
        }


    }

    /**
     * @throws
     * @author 判断角色机构 0为总行库管
     * @Description: TODO(这里用一句话描述这个方法的作用)
     */
    public static String getJigouLeibie(String jigouId) throws Exception {
        String mothedName = "getJigouLeibie";
        WebParameter[] param = {new WebParameter<String>("arg0", jigouId)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL2);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("params:=" + params);
        return params;
    }

    // 指纹采集

    /**
     * @param userId  用户编号
     * @param finger  手指
     * @param cValue  特征值1
     * @param cValue1 特征值1
     * @return
     * @throws Exception
     */
    public static boolean fingerprintInput(String userId, String finger, byte[] cValue, byte[] cValue1)
            throws Exception {
        String methodName = "fingerprintInput";
        WebParameter[] param = {new WebParameter<String>("arg0", userId),
                new WebParameter<String>("arg1", finger), new WebParameter<byte[]>("arg2", cValue),
                new WebParameter<byte[]>("arg3", cValue1),};

        SoapObject soap = WebService.getSoapObject(methodName, param, ServerUrl.NAMESPACE, ServerUrl.URL);
        String code = soap.getProperty("code").toString();
        if ("00".equals(code)) {
            return true;
        }
        return false;

    }

    /**
     * @throws
     * @author 判断押运员是否有未完成任务
     * @Description: carId 车牌号 userId 用户账号
     */
    public static boolean upCkYaYunYuanRenWuState(String carId, String userId) throws Exception {
        String methodName = "upCkYaYunYuanRenWuState";
        WebParameter[] param = {new WebParameter<String>("arg0", carId),
                new WebParameter<String>("arg1", userId),};

        SoapObject soap = WebService.getSoapObject(methodName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        if ("00".equals(code)) {
            return true;
        } else if ("99".equals(code)) {
            return false;
        }
        return false;

    }

    /**
     * 温馨提示车辆与人员的绑定
     *
     * @param chepaihao
     * @param yayunid
     * @return 00=success
     * @throws Exception
     */
    public static String upCkCarRenBangDing(String chepaihao, String yayunid) throws Exception {
        String mothedName = "upCkCarRenBangDing";
        WebParameter[] param = {new WebParameter<String>("arg0", chepaihao),
                new WebParameter<String>("arg1", yayunid)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("params:=" + params);
        return params;
    }

    /**
     * @throws
     * @author 名字
     * @Description: 判断派工单是否已撤销
     */
    public static String upCkRenWuState(String paigongdan, String yayunid) throws Exception {

        String mothedName = "upCkRenWuState";
        WebParameter[] param = {new WebParameter<String>("arg0", paigongdan),
                new WebParameter<String>("arg1", yayunid)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("params:=" + params);
        return params;
    }

    /**
     * @throws
     * @author 名字
     * @Description: 判断派工单是否已撤销
     */
    public static String getcurrentTime() throws Exception {

        String mothedName = "getCurrentTime";
        WebParameter[] param = new WebParameter[0];
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        System.out.println("params:=" + params);
        return params;
    }

    /**
     * 进入周转箱扫描界面时，调用此方法，判断是否使用密码锁
     *
     * @param params 预留参数，暂不使用
     * @return true：使用，false：不使用
     * @throws Exception
     * @author zhouKai
     */
    public static boolean isUseCodedLock(String params) throws Exception {
        String mothedName = "isUseCodedLock";
        WebParameter[] param = new WebParameter[0];
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String result = soap.getProperty("params").toString();
        return "true".equals(result);
    }

    /**
     * 把操作日志持久化到数据库中
     *
     * @param operateLog 操作日志的实体类
     * @return 00：持久化成功， 99：持久化失败
     * @throws Exception
     * @author zhouKai
     */
    public static String saveOperateLog(OperateLog operateLog) throws Exception {
        String mothedName = "saveOperateLog";
        String operateLogInfo = new Gson().toJson(operateLog);
        WebParameter[] param = {new WebParameter<String>("arg0", operateLogInfo)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);
        String code = soap.getProperty("code").toString();
        return code;
    }


    public String listennum() {

        return null;
    }

    /**
     * 返回单个的车牌号码
     *
     * @param zhanghao
     * @return
     * @throws Exception
     */
    public static String getReturnChePaiHaoItem(String zhanghao) throws Exception {

        String mothedName = "getReturnChePaiHaoItem";//服务端请求的方法
        WebParameter[] param = {new WebParameter<String>("arg0", zhanghao)};
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：" + zhanghao);

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }
//    ----------------------------------------

    /***
     * 请求盘库任务列表展示
     * <p>
     * 202001013
     */

//   http://3212g13a06.zicp.vip/cashman/webservice/checkInventory/inventoryTaskPage?userId=43534&page={\"pageIndex\":\"1\",\"pageSize\":20,\"keyword\":\"\",\"startTime\":\"2020-11-01\",\"endTime\":\"\"}&result=""&checkType=&userId=43534
//http://3212g13a06.zicp.vip/cashman/webservice/checkInventory/inventoryTaskPage?page={\"pageIndex\":\"1\",\"pageSize\":20,\"keyword\":\"\",\"startTime\":\"2020-11-01\",\"endTime\":\"\"}&result=""&checkType=&userId=43534
//    http://3212g13a06.zicp.vip/cashman/webservice/scutcheon/inventoryTaskPage?arg0={\"pageIndex\":\"1\",\"pageSize\":20,\"keyword\":\"\",\"startTime\":\"2020-11-01\",\"endTime\":\"2020-11-03\"}&arg1=""&arg2=""&arg3="43534"
//    int[] numbers = {1, 2, 3, 4, 5};
    String[] page = {"pageIndex", "1",
            "pageIndex", "20",
            "keyword", "2",
            "startTime", "2020-10-01",
            "endTime", "2020-11-01",
    };


    public static String PKTaskList(String page, String result, String checkType, String Userid) throws Exception {
        Page page1 = new Page();
        page1.setPageIndex("1");
        page1.setPageIndex("20");
        page1.setKeyword("");
        page1.setStartTime("2020-10-01");
        page1.setEndTime("2020-11-03");
        String json = JSON.toJSONString(page1, true);
//        JSONObject jsonObject = JSONObject(page1);
        String mothedName = "inventoryTaskPage";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", json),
                new WebParameter<String>("arg1", result),
                new WebParameter<String>("arg2", checkType),
                new WebParameter<String>("arg3", Userid)

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    //    http://3212g13a06.zicp.vip/cashman/webservice/checkInventory/inventoryTaskList?arg0=""&arg1=""&arg2=43534
//    inventoryTaskList
    public static String PKTaskListVersion2(String starttime, String endtime, String Userid) throws Exception {
//        Page page1 = new Page();
//        page1.setPageIndex("1");
//        page1.setPageIndex("20");
//        page1.setKeyword("");
//        page1.setStartTime("2020-10-01");
//        page1.setEndTime("2020-11-03");
//        String json = JSON.toJSONString(page1, true);
//        JSONObject jsonObject = JSONObject(page1);

        Log.e(TAG, "参数 arg0" + starttime);
        Log.e(TAG, endtime);
        Log.e(TAG, Userid);

        String mothedName = "inventoryTaskList";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", starttime),
                new WebParameter<String>("arg1", endtime),
                new WebParameter<String>("arg2", Userid),
//                new WebParameter<String>("arg3", Userid)

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /***
     * 没有任务发起任务的接口9.2
     *
     * @param starttime
     * @param endtime
     * @param Userid
     * @return
     * @throws Exception http://192.168.1.138:8089/cash/webservice/cash_cm/pkupdata？
     *                   arg0=userid&arg1=imageName&arg2==json
     *                   checkType, dataLibrary, App.user.getName(), userid
     */
    public static String addTask(String checkType, String dataLibrary, String userName, String userid) throws Exception {
        String mothedName = "addTask";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", checkType),
                new WebParameter<String>("arg1", dataLibrary),
                new WebParameter<String>("arg2", userName),
                new WebParameter<String>("arg3", userid)
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return code;
        } else {
            return msg;
        }
    }


    /***
     * 最终提交数据代码
     * <p>
     * 操作人
     * 图片名称
     * 第一次传递
     */

    public static String UpdataPKiamge(String zhanghao, byte[] fileString, String imageName, String imagelength) throws Exception {

        String mothedName = "UpdataPKlist";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", zhanghao),
//                new WebParameter<byte []>("arg1", fileString),
                new WebParameter<byte[]>("arg1", fileString),
                new WebParameter<String>("arg2", imageName),
                new WebParameter<String>("arg3", imagelength),

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACE, ServerUrl.URL1);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }


    /***
     最后的提交数据


     ***/


    /****
     * 7.1 查看核心接口数据明细
     * 获取银行的明细
     * http://3212g13a06.zicp.vip/cashman/webservice/checkInventory/listCoreDetail?arg0=CK20201106171135&argg1=43534
     * listCoreDetail
     * ? arg0 =任务编号
     * & arg1 =用户编号
     */


    public static String listCoreDetail(String TaskNO, String userNO) throws Exception {
        Log.e(TAG, TaskNO);
        Log.e(TAG, userNO);
        String mothedName = "listCoreDetail";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", TaskNO),
                new WebParameter<String>("arg1", userNO)
        };
        System.out.println("arg0-------------传参：" + TaskNO);
        System.out.println("arg1-------------传参：" + userNO);

        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("code-------------传参：" + soap.getProperty("code").toString());
        System.out.println("params-------------传参：" + soap.getProperty("params").toString());

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /***
     * 获取未完成标牌明细信息
     * lian大壮
     * 20201102
     * {"MONEYDETAIL":"硬五分（3套）","SCUTCHEONSNUM":"BP001","MONEY":"231","DAMAGEDSTATE":"完整券","ID":"34b9558e4e514163b5e323f3423d18ad","EDITIONNUM":"0","MONEYNUM":"0M"},{"MONEYDETAIL":"硬二分（3套）","SCUTCHEONSNUM":"BP001","MONEY":"213","DAMAGEDSTATE":"完整
     */

    public static String getScutcheonDetailAndSum1(String PKNO) throws Exception {
        String mothedName = "getScutcheonDetailAndSum";//服务端请求的方法
        WebParameter[] param = {new WebParameter<String>("arg0", PKNO)};
        Log.e(TAG, "ServerUrl.URL3-------------url：" + ServerUrl.URL20);
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL20);//不穿参数后param的位置写上null
        System.out.println("ServerUrl.URL3-------------url：" + ServerUrl.URL20);
        System.out.println("YanZhengZhiWen-------------传参：" + PKNO);
        Log.e(TAG, "ServerUrl.URL3-------------url：" + ServerUrl.URL20);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }


    /***
     * 接口8.1
     * 提交接口明细
     * <p>
     * arg0  repertoryRental 库存标牌总额
     * Arg1  atmCashMoney    ATM加钞款项
     * Arg2  payment      调缴款项
     * Arg3   other   其他款项
     * Arg4 info
     * String repertoryRental, String atmCashMoney, String payment, String other,
     */
    public static String PKREcAcupdatainfpinfo(String userid, String info) throws Exception {
        String mothedName = "getScutcheonDetailAndSum";//服务端请求的方法
        WebParameter[] param = {
//                new WebParameter<String>("arg0", repertoryRental),
//                new WebParameter<String>("arg1", atmCashMoney),
//                new WebParameter<String>("arg2", payment),
//                new WebParameter<String>("arg3", other),
                new WebParameter<String>("arg0", userid),
                new WebParameter<String>("arg1", info)


        };
        Log.e(TAG, "ServerUrl.URL3-------------url：" + ServerUrl.NAMESPACEseven);
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL20);//不穿参数后param的位置写上null
        Log.e(TAG, "ServerUrl.URL3-------------url：" + ServerUrl.URL20);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }


    /***
     * 8  接口  获取数据源代码接口
     * <p>
     * 20202  1104    无参数传
     */

    public static String getMoneyInfoList() throws Exception {

        String mothedName = "getMoneyEditList";//服务端请求的方法
        WebParameter[] param = {
        };
        Log.e(TAG, "ServerUrl.URL3-------------url：" + ServerUrl.NAMESPACEseven);
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL20);//不穿参数后param的位置写上null
        Log.e(TAG, "ServerUrl.URL3-------------url：" + ServerUrl.URL20);
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /**
     * 接口6.1获取标牌 已扫描到的标牌
     *
     * @param PKNo
     * @param userId
     * @return
     * @throws Exception http://3212g13a06.zicp.vip/cashman/webservice/detailInfo?arg0=CK20201106181046&arg1="11,22,33"
     */
    public static String detailInfo(String PKNo, String userId) throws Exception {
        String mothedName = "detailInfo";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", PKNo),
                new WebParameter<String>("arg1", userId),
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /**
     * 接口6.2   获取库内的所有标牌
     *
     * @param PKNo
     * @param userId
     * @return
     * @throws Exception
     */

    public static String repertoryInfo(String PKNo, String userId) throws Exception {
        String mothedName = "repertoryInfo";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", PKNo),
                new WebParameter<String>("arg1", userId),
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /***
     * 修改标牌的状态
     */

    public static String saveCheckInventoryDetails(String checkId, String plateNumbers, String userId, String UserName) throws Exception {
        String mothedName = "saveCheckInventoryDetails";//服务端请求的方法


        WebParameter[] param = {
                new WebParameter<String>("arg0", checkId),
                new WebParameter<String>("arg1", plateNumbers),
                new WebParameter<String>("arg2", userId),
                new WebParameter<String>("arg3", UserName)
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return code;
        } else {
            return msg;
        }
    }

    /**
     * http://192.168.1.138:8089/cash/webservice/cash_cm/BiaoPailist?arg0=PK00001
     * http://3212g13a06.zicp.vip/cashman/webservice/scutcheon/BiaoPailist?arg0=PK00001
     * <p>
     * <p>
     * 查看核心数据明细
     */


    public static String SelectCenterInfo(String checkId, String plateNumbers, String userId) throws Exception {
        String mothedName = "saveCheckInventoryDetails";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", checkId),
                new WebParameter<String>("arg1", plateNumbers),

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

    /***
     * 增加标牌明细
     * 8.2  提交标牌明细*
     * <p>
     * arg0  cropId   机构编号
     * Arg1  userName  操作人
     * jsonStr     json串（标牌所属明细）
     */

    public static String editInventoryMaintain(String cropId, String userName, String jsonStr) throws Exception {
        String mothedName = "editInventoryMaintain";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", cropId),
                new WebParameter<String>("arg1", userName),
                new WebParameter<String>("arg2", jsonStr)

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return code;
        } else {
            return params;
        }
    }


    /***
     * 9.1
     * http://192.168.1.138:8089/cashman/webservice/ checkInventory/
     * addHandwrittenSignature
     * <p>
     * 盘库提交图片*  耗时操作需要分两步
     * 接口说明：后台分两步，如下：
     * 9-1 盘库提交图片
     * <p>
     * checkId	任务编号              必填
     * handwrittenSignature 	图片字符串 必填    传byte		userId	用户id    必填
     */

    public static String addHandwrittenSignature(String checkId, byte[] handwrittenSignature, String userId) throws Exception {
        String mothedName = "addHandwrittenSignature";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", checkId),
                new WebParameter<byte[]>("arg1", handwrittenSignature),
                new WebParameter<String>("arg2", userId)

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return code;
        } else {
            return code;
        }
    }


    /***
     * 获取 券别  信息
     * <p>
     * listMoney
     */
    public static String listMoney() throws Exception {
        String mothedName = "listMoney";//服务端请求的方法
        WebParameter[] param = {
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return msg;
        }
    }

    /***
     * 获取版别
     * <p>
     * listMoney
     */
    public static String listEditionByMoneyId(String moneyid) throws Exception {
        String mothedName = "listEditionByMoneyId";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", moneyid),
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");
        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return msg;
        }
    }


    /****
     * 9-2  最后的数据提交
     * <p>
     * 接口名 ：inventoryReconciliation
     * 参数名 ：   checkId	任务编号              必填
     * storekeeperName	库管员名字  必填
     * userId	用户id    必填
     */
    public static String inventoryReconciliation(String checkId, String userId, String storekeeperName) throws Exception {
        String mothedName = "inventoryReconciliation";//服务端请求的方法
        System.out.println("YanZhengZhiWen-------------传参：" + checkId);
        System.out.println("YanZhengZhiWen-------------传参：" + storekeeperName);
        System.out.println("YanZhengZhiWen-------------传参：" + userId);

        WebParameter[] param = {
                new WebParameter<String>("arg0", checkId),
                new WebParameter<String>("arg1", storekeeperName),
                new WebParameter<String>("arg2", userId)
        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return code;
        } else {
            return msg;
        }
    }


//---------------------------------分割符   盘库接口


    /***
     * 获取盘库任务数据
     *
     * @param starttime
     * @param endtime
     * @param Userid
     * @return
     * @throws Exception
     */

    public static String inventoryTaskListForCheckInventory(String starttime, String endtime, String Userid) throws Exception {

        Log.e(TAG, "参数 arg0" + starttime);
        Log.e(TAG, endtime);
        Log.e(TAG, Userid);

        String mothedName = "inventoryTaskListForCheckInventory";//服务端请求的方法
        WebParameter[] param = {
                new WebParameter<String>("arg0", starttime),
                new WebParameter<String>("arg1", endtime),
                new WebParameter<String>("arg2", Userid),

        };
        SoapObject soap = WebService.getSoapObject(mothedName, param, ServerUrl.NAMESPACEseven, ServerUrl.URL21);//不穿参数后param的位置写上null
        System.out.println("YanZhengZhiWen-------------传参：");

        String code = soap.getProperty("code").toString();
        String msg = soap.getProperty("msg").toString();
        String params = soap.getProperty("params").toString();
        if ("00".equals(code)) {
            return params;
        } else {
            return null;
        }
    }

}














